{% extends "base.html" %}

{% block title %}交易分析系统-首页{% endblock %}
{% block navbar %}
<nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <!-- The mobile navbar-toggle button can be safely removed since you do not need it in a non-responsive implementation -->
          <a class="navbar-brand" href="/">交易分析系统</a>
        </div>
        <!-- Note that the .navbar-collapse and .collapse classes have been removed from the #navbar -->
        <div id="navbar">
          <ul class="nav navbar-nav">
            <li class="active"><a href="/">首页</a></li>
            <li><a href="{{url_for('history', _external=True)}}">历史记录</a></li>
            <li><a href="{{url_for('about', _external=True)}}">关于</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">当前登录用户：{{current_user}}</a></li>
            <li><a href="{{url_for('logout', _external=True)}}">登出</a></li>
          </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>
{% endblock %}


{% block page_content %}
	<div class="page-content">

        {% if results %}
        <p><h2 align="center">交易分析汇总报告</h2></p>
        <p><h2> 保证金中心账户：{{ account_num }} </h2></p>
            {% for result in results %}
            <h3>{{ result[1] }} 年 {{ result[2] }} 月</h3>
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>名称</th>
                        <th>内容</th>
                        <th>名称</th>
                        <th>内容</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>上月结余</td>
                        <td>{{ result[3] | round(2) }} 元</td>
                        <td>当月结余</td>
                        <td>{{ result[4] | round(2) }} 元</td>
                    </tr>
                    <tr>
                        <td>当月出入金</td>
                        <td>{{ result[5] | round(2) }} 元</td>
                        <td>当月手续费</td>
                        <td>{{ result[6] | round(2) }} 元</td>
                    </tr>
                        <td>持仓风险度</td>
                        <td>{{ result[7] }}</td>
                        <td>平均持仓时间(60分钟)</td>
                        <td>{{ result[8] | round(1) }}</td>
                    </tr>
                    <tr>
                        <td>平仓盈亏</td>
                        <td>{{ result[9] }} 元</td>
                        <td>收益率</td>
                        <td>{{ result[10] }}%</td>
                    </tr>
                    <tr>
                        <td>盈利金额</td>
                        <td>{{ result[11] | round(2) }} 元</td>
                        <td>亏损金额</td>
                        <td>{{ result[12] | round(2) }} 元</td>
                    </tr>
                    <tr>
                        <td>盈利笔数</td>
                        <td>{{ result[13] }}</td>
                        <td>亏损笔数</td>
                        <td>{{ result[14] }}</td>
                    </tr>
                    <tr>
                        <td>平均盈利持仓时间(60分钟)</td>
                        <td>{{ result[15] | round(1) }}</td>
                        <td>平均亏损持仓时间(60分钟)</td>
                        <td>{{ result[16] | round(1) }}</td>
                    </tr>
                    <tr>
                        <td>最大单笔盈利</td>
                        {% if result[17] > 0 %}
                        <td>{{ result[17] | round(2) }} 元</td>
                        {% else %}
                        <td>无</td>
                        {% endif %}
                        <td>最大单笔亏损</td>
                        {% if result[18] != 0 %}
                        <td>{{ result[18] | round(2) }} 元</td>
                        {% else %}
                        <td>无</td>
                        {% endif %}
                    </tr>
                    <tr>
                        <td>正确率</td>
                        <td>{{ result[19] | round(1) }}%</td>
                        <td>盈亏比</td>
                        <td>{{ result[20] }}</td>
                    </tr>
                </tbody>
            </table>
            {% if result[2] < 10 %}
            <p><a href="/detail/{{ account_num }}/{{ result[1] }}/0{{ result[2] }}">点击查看详细内容</a></p>
            {% else %}
            <p><a href="/detail/{{ account_num }}/{{ result[1] }}/{{ result[2] }}">点击查看详细内容</a></p>
            {% endif %}
            {% endfor %}
        {% endif %}


        <p><h4><a href="/">回首页</a></h4></p>
    </div>

{% endblock %}
